OnPage Lighthouse API: Overview
The OnPage Lighthouse API is a tool for leveraging the capabilities of Lighthouse – Google’s open-source project intended to help webmasters access the data on the performance and quality of web pages and web apps.
Lighthouse reports the performance metrics simulating a mid-tier mobile device on a 4G internet connection. To achieve that, Lighthouse incorporates sophisticated architecture, illustrated below. You can get more information about how Lighthouse works by visiting the official documentation of Google’s Lighthouse project.
Note that OnPage Lighthouse API is based on Google’s open-source Lighthouse project. The data returned in the
results array of the API’s response is identical to that described in the project’s official documentation. You can refer to it for more information about the content and structure of the data provided by OnPage Lighthouse API.
Sending a web page for crawling is done through a POST request to the Lighthouse Task POST endpoint. Alongside the URL of the web page, you can specify additional parameters, which would help you filter the data and get the results you need:
● Audits contain the results of the audits and keyed by their titles; to get only certain audits, you should specify their titles in the corresponding Task POST array; you can obtain the list of titles of all available audits by requesting the Lighthouse Audits endpoint.
● Categories contain different categories, their scores, and references to the audits that comprise them.
After the website is fetched for crawling, you can start retrieving results by passing the
task_id of the tasks in the Lighthouse Task GET endpoint. For now, you can obtain results in JSON only, but we plan to add support for HTML in the nearest future.
Learn more about task completion and obtaining a list of completed tasks in this help center article.
Alternatively, you can specify
postback_url when setting a task, and we will notify you on completion of tasks or send the results to you respectively.
If you do use
postback_url, you can receive the list of id for all completed tasks using the Tasks Ready endpoint. It is designed to provide you with a list of completed tasks, which haven’t been collected yet.
You can send up to 2000 API calls per minute, with each POST call containing no more than 100 tasks. Contact us if you would like to raise the limit. Note that the maximum number of simultaneous requests you can send is limited to 30.
If your system requires delivering instant results, the Lighthouse Live endpoint is the best solution for you as it doesn’t require making separate POST and GET requests to the corresponding endpoints.
You can test the Lighthouse OnPage API for free using DataForSEO Sandbox.